feat: Allow for request headers to be passed in#446
Conversation
| # requires a couple extra lines | ||
| self.js_logger.reset() | ||
|
|
||
| await self._apply_headers() |
There was a problem hiding this comment.
Is there a potential for a race condition here, where some requests might get sent before the headers are applied? Should _apply_headers() be called earlier in this function?
There was a problem hiding this comment.
As we discussed, maybe? Moving this call earlier shouldn't hurt anything, so I'll do that.
There was a problem hiding this comment.
@camdecoster Are you still OK with moving this call earlier?
Also, should the headers be applied to the initial call to Page.navigate?
There was a problem hiding this comment.
I moved it before the call to Page.navigate but forgot to push changes. It will show up soon.
| async def _apply_headers(self): | ||
| """Apply extra HTTP headers to the tab if configured.""" | ||
| if self._headers: | ||
| _logger.debug2(f"Setting extra HTTP headers on {self.tab}") |
There was a problem hiding this comment.
nit:
so here i would do like
_logger.debug(f"Setting extra HTTP headers on {self.tab}")
_logger.debug2(f"Extra headers are: {self._headers}")When debugging is turned up to level 2, the amount of output is ENORMOUS, so if its a normal debugging situation and it's not a huge dump, I'd debug on level 1, regular _logger.debug.
There was a problem hiding this comment.
I'll update it.
Description
Allow for request headers to be passed from Kaleido to Choreographer.
Closes #445.
Changes
headerskeyword argument for Kaleido classTesting